package myJs.detailInfo

import cats.effect.IO
import japgolly.scalajs.react.ScalaFnComponent
import japgolly.scalajs.react.util.EffectCatsEffect._
import japgolly.scalajs.react.vdom.all._
import myJs.Implicits._
import myJs.Utils._
import myJs.api.Api
import myJs.cps.BootstrapTableCp
import myJs.cps.BootstrapTableCp.Column
import myJs.myPkg.Hooks._
import myJs.myPkg.reactBootstrap._
import myJs.tool.Pojo._
import myJs.tool.Tool
import shared.pojo.Browse._
import upickle.default._

import scala.collection.immutable.SeqMap
import scala.scalajs.js

/** Created by yz on 28/11/2023
  */
object SvPlotCp {

  case class Props(id: String)

  val Component = ScalaFnComponent[Props] { props =>

    object FTool {

    }

    div(
      div(
        width := "60%",
        div(
          className := "btn-group",
          float.right,
          a(
            className := "btn  btn-default idsButton",
            href := "javascript:;",
            dataToggle := "dropdown",
            dataCloseOthers := "true",
            ariaExpanded := "false",
            title := "Download image",
            dataHover := "dropdown",borderRadius:=4.px,
            i(className := "fa fa-bars")
          ),
          ul(
            className := "dropdown-menu pull-right",
            li(
              a(href := s"${Api.browse.downloadMummerFile(props.id, "SV_cycle.png")}", "Download PNG image")
            ),
            li(
              a(href := s"${Api.browse.downloadMummerFile(props.id, "SV_cycle.svg")}", "Download SVG image")
            )
          )
        ),
        img(width := "100%", src := s"${Api.browse.getMummerImage(props.id, "SV_cycle.png")}")
      )
    )

  }

  def apply(id: String) = {
    Component(Props(id))
  }

}
